package red.lixiang.dao;

import red.lixiang.model.Order;
import red.lixiang.model.Product;
import red.lixiang.model.Report;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface OrderDAO {

    int insertNewOrder(Order order);

    int insertOrderProduct(@Param("orderId") int orderId,
                           @Param("barCode") String barCode,
                           @Param("productNum") int productNum,
                           @Param("discount") Double discount,
                           @Param("saleType") int saleType,
                           @Param("salePrice")Double salePrice);

    List<Report> getMemberSale(Integer id);

    Order getOrderById(Integer id);

    List<Order> getOrderByType(@Param("type") Integer type,@Param("memberId") Integer memberId);

    List<Order> getOrderByMemberId(@Param("memberId") Integer memberId);

    List<Product> getOrderProductByOrderId(Integer orderId);

    int contactMember(@Param("memberId") Integer memberId,
                      @Param("orderId") Integer orderId);


    List<Order> getOrdersByTime(@Param("beginTime") String beginTime , @Param("endTime") String endTime);

    int updateOrder(Order order);

}
